package com.techsoul.module.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.techsoul.common.core.pojo.vo.UserVo;
import com.techsoul.module.basic.pojo.vo.CustomerVo;
import com.techsoul.module.goods.pojo.entity.Spu;
import com.techsoul.module.order.pojo.entity.SalesOrder;
import com.techsoul.module.order.pojo.param.SalesOrderSaveParam;
import com.techsoul.module.order.pojo.entity.SalesOrderItem;
import com.techsoul.module.order.pojo.param.SalesOrderItemSaveParam;
import com.techsoul.module.order.pojo.param.SalesOrderItemSearchParam;
import com.techsoul.module.order.pojo.vo.SalesOrderItemFailedVo;
import com.techsoul.module.order.pojo.vo.SalesOrderItemVo;
import com.techsoul.module.pms.pojo.entity.GoodsGroup;
import com.techsoul.module.goods.pojo.entity.Sku;
import org.springframework.web.multipart.MultipartFile;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 销售订单明细 Service接口
 * 
 * @author liuen
 * @date 2020-12-07
 */
public interface ISalesOrderItemService {

    /**
     * 新增
     * @param params
     * @return
     */
    String insert(SalesOrderItemSaveParam params);

    /**
     * 逻辑删除
     * @param id
     * @return
     */
    Integer delete(String id);

    /**
     * 根据订单ID逻辑删除
     * @param orderId
     */
    void deleteByOrderId(String orderId);

    /**
     * 批量逻辑删除
     * @param idList
     */
    void batchDelete(List<String> idList);

    /**
     * 修改
     * @param id
     * @param params
     * @return
     */
    Integer update(String id, SalesOrderItemSaveParam params);


    /**
     * 修改
     * @param id
     * @param params
     * @param userVo
     * @return
     */
    Integer updateFromAsnc(String id, SalesOrderItemSaveParam params,UserVo userVo);
    /**
     * 详情
     * @param id
     * @return
     */
    SalesOrderItemVo findById(String id);

    SalesOrderItemVo findByCustSalesOrderItemNo(String custSalesOrderItemNo);
    String suppierReportDepart(Map map);
    /**
     * 列表
     * @param params
     * @return
     */
    List<SalesOrderItemVo> findAll(SalesOrderItemSearchParam params);

    /**
     * 品牌排行列表-分页
     * @param params
     * @param current
     * @param pageSize
     * @return
     */
   // IPage<SalesOrderItemBrandRateViewVo> brandRateView(SalesOrderItemSearchParam params, Integer current, Integer pageSize);

    /**
     * 供应商排行列表-分页
     * @param params
     * @param current
     * @param pageSize
     * @return
     */
  //  IPage<SalesOrderItemSupplierRateViewVo> supplierRateView(SalesOrderItemSearchParam params, Integer current, Integer pageSize);

    /**
     * 列表-分页
     * @param params
     * @param current
     * @param pageSize
     * @return
     */
    IPage<SalesOrderItemVo> findAll(SalesOrderItemSearchParam params, Integer current, Integer pageSize);

    /**
     * 单品销售排行列表-分页
     * @param params
     * @param current
     * @param pageSize
     * @return
     */
    IPage<SalesOrderItemVo> skuRateView(SalesOrderItemSearchParam params, Integer current, Integer pageSize);

    /**
     * 导入模板
     */
    String importTemplate();

    /**
     * 导入
     * @param data
     * @return
     */
    SalesOrder importData(String customerNo, SalesOrderItemVo data,String needOrderYn,UserVo user,int itemNo,int line,CustomerVo customerVo, SalesOrder newSalesOrder) ;


    /**
     * 历史数据导入
     * @param file
     * @return
     */
    String dataMigration(String customerNo, MultipartFile file);

    /**
     * 从mq导入
     * @param salesOrderItemVo
     */

    String importOrderFromMq(SalesOrderItemVo salesOrderItemVo,String customerNo);
    String readMq(SalesOrderSaveParam params);
    String createReturn(SalesOrderItemSaveParam params);
    Integer importAgain(String id);
    void genOperationLog(SalesOrderItem data,UserVo user );

    SalesOrder addNewSalesOrder(SalesOrderItemVo salesOrderItemVo, UserVo userVo, CustomerVo customerVo,int line);
    SalesOrderItem addNewItem(SalesOrder newSalesOrder, SalesOrderItemVo data,UserVo userVo,int itemNo,int line);


    SalesOrder addMigrationSalesOrder(SalesOrderItemVo salesOrderItemVo, UserVo userVo, CustomerVo customerVo,int line);
    SalesOrderItem addMigrationItem(SalesOrder newSalesOrder, SalesOrderItemVo data,UserVo userVo,int itemNo,int line);



    SalesOrderItemVo removeSpecialChar(SalesOrderItemVo input);
    Sku generateNewSku(SalesOrderItemVo materialBuyPriceVo, Spu spu);
    Spu generateNewSpu(SalesOrderItemVo materialBuyPriceVo);
    Spu genAddGood(SalesOrderItemVo data, UserVo user);
    GoodsGroup generateNewGoodsGroup(SalesOrderItemVo materialBuyPriceVo);
    Sku genAddGoodSku(SalesOrderItemVo data,UserVo user,Spu newspu);
    String exportData(SalesOrderItemSearchParam params);
    /**
     * 获得地区销售额
     *
     * @return
     */
    BigDecimal countTotalSale(SalesOrderItemSearchParam site);
    List<SalesOrderItemFailedVo> findfailed(SalesOrderItemSearchParam params);
    /**
     * 获得地区采购额
     *
     * @return
     */
    BigDecimal countTotalPurchase(SalesOrderItemSearchParam site);

    /**
     * 获得地区订单数
     *
     * @return
     */
    Integer findTotalOrder(String site);
    /**
     * 获得当天地区订单数
     *
     * @return
     */
    Integer findTotalTodayOrder(SalesOrderItemSearchParam salesOrderItemSearchParam);

    void fixdata();
}
